//导入

import React,{Component} from 'react';
import PropTypes from 'prop-types';

import {Route,NavLink} from 'react-router-dom';


import './VoteIslan.less';
import Navigation from './common/navigation/Navigation';
import IndexPage from './index-page/IndexPage';
import AnswerQuestions from './answer-questions/AnswerQuestions';
import AnswerScore from './answer-score/AnswerScore';
import AnswerList from './answer-list/AnswerList';

import TestContext from './answer-list/test-context'



class VoteIslan extends Component {


    constructor(props){
        super(props);

        this.state = {navConfig:null};
        this.setNavConfig = this.setNavConfig.bind(this);

    }

    getChildContext() {
        return {
            setNavConfig: this.setNavConfig,
            voteislan:"顶层",
            text: "全局",
        };
    }

    setNavConfig(config){
        this.setState({navConfig:config});
    }

    render() {
        return (
            <div className="vote-islan">
                <Navigation navConfig={this.state.navConfig} />
                <TestContext />
                <div className="component-area">
                <Route path="/" exact component={IndexPage} />
                <Route path="/questions" component={AnswerQuestions} />
                <Route path="/score" component={AnswerScore} />
                <Route path="/answerlist" component={AnswerList} />
                </div>
            </div>
        );
    }
}


VoteIslan.childContextTypes = {
    setNavConfig: PropTypes.func,
    voteislan:PropTypes.string,
    text: PropTypes.string
};

export {VoteIslan};